home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / mrcry204.zip / INTEGRAL.EKA < prev    next >
Text File  |  1991-03-04  |  522b  |  21 lines

  1. ; Demo of numerical integration
  2.  
  3. ; a simple one
  4. a = INTEG(SIN(x),x,0,PI)
  5. a_true = 2
  6.  
  7. ; an important improper integral
  8. b = INTEG(EXP(-x^2),x,0,INF)
  9. b_true = SQRT(PI)/2
  10.  
  11. ; an integral with a nasty singularity at an endpoint
  12. c = INTEG(x^-.5 LN(x),x,0,1)
  13. c_true = -4
  14.  
  15. d = INTEG(|x^2 + 2x - 2|^-.5,x,0,1)
  16. ; the nasty singularity is near SQRT(3)-1, so try to remove it
  17. sing = SQRT(3) - 1
  18. d1 = INTEG(|x^2 + 2x - 2|^-.5,x,0,sing) +
  19.      INTEG(|x^2 + 2x - 2|^-.5,x,sing,1)
  20. d_true = PI/2 - ATAN(2^-.5) + LN(3)/2
  21.